package com.gitee.wsl.store.db

import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO

/*
fun createRoomDatabase():  RoomDatabase.Builder<KVStoreDatabase> {
    val dbFile = "${fileDirectory()}/$DB_NAME"

    return Room.databaseBuilder<KVStoreDatabase>(
        name = dbFile,
        factory =  { KVStoreDatabase::class.instantiateImpl() }
    ).setDriver(BundledSQLiteDriver())
        .setQueryCoroutineContext(Dispatchers.IO)
}


private fun fileDirectory(): String {
    val documentDirectory: NSURL? = NSFileManager.defaultManager.URLForDirectory(
        directory = NSDocumentDirectory,
        inDomain = NSUserDomainMask,
        appropriateForURL = null,
        create = false,
        error = null,
    )
    return requireNotNull(documentDirectory).path!!
}*/
